AccessToken
Get access-token
Access-token value is a value generated according to the user name and password to distinguish other users.
Token may expire at any time. It is recommended to obtain the token once every time you use the script to execute.
Request address
POST
http://OmsAddress/app/newoms.php/webservice/token?cmd=10000&ip-type=webservicerest
POST request parameter description
Parameter name | Array type | Description | Whether the field is required | Remarks |
---|---|---|---|---|
username | string | User Name | Yes | |
password | string | User Password | Yes | |
register_type | integer | Account registration method. 1: User registered using a password 2: User authenticated by webservice | No | The default value is the login method of the current OMS |
authtype | integer | 0: OA login token verification, 1: OA login password verification | No | OA login is no longer supported. This parameter does not need to be filled in. Please use webservice user authentication |
Data Parameters
Use json format to represent the record related information. The following is an example:
{
"username": "tcaplus",
"register_type": 1,
"password": "tcaplus"
}
Return Syntax
Return Parameter Description
Field name | Data type | Description | Remarks |
---|---|---|---|
code | integer | 0 means a successful return; non-0 means an error return. | |
error | string | Error message when code is not 0 | |
token | string | Token value of the specified user obtained when the code is 0 |
Request Example
Send A Request through the Curl Method
curl -H "Content-type: application/json" -X "POST" -d '{
"username": "tcaplus",
"register_type": 1,
"password": "tcaplus"
}' 'http://omsaddress/app/newoms.php/webservice/token?cmd=10000&ip-type=webservicerest'
Return Example
Successful Return Example
Status of http request = 200
{
"code": 0,
"error": "",
"token": "081dcfbc6f804d9a9fce29fc2f50076486fff972"
}
Failed Return Example
Status of http request != 200
{
"source_ip": "ip:10.29.89.51 not in whitelist"
}
{
"code": 1,
"error": "user name does not exist"
}